/*=====================================================
Critical Links
Auto Configuration Server

Authors:
	Rui Eduardo Gouveia Gil - r-gil@critical-links.com

Date: 2011
Version 0.1
=======================================================*/
Command = function(xml) {	
	if(xml)
	{
		var xmlDoc = parseXML(xml);
	
		this.type = 'cmd';
		this.id = xmlDoc.getElementsByTagName("ID")[0].childNodes[0].nodeValue;
		this.index = xmlDoc.getElementsByTagName("Index")[0].childNodes[0].nodeValue;
		this.action = xmlDoc.getElementsByTagName("Action")[0].childNodes[0].nodeValue;
		this.args = new Array(); 
		for(var i=0; i<xmlDoc.getElementsByTagName("Argument").length; i++) {
			this.args.push(xmlDoc.getElementsByTagName("Argument")[i].childNodes[0].nodeValue);
		}
	}
	else
	{
		this.type = 'cmd';
		this.id = 0;
		this.index = 0
		this.action = '';
		this.args = new Array(); 
	}
};

Ext.reg('appcommand', Command);